package com.example.toucheventsample

import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.view.MotionEvent
import android.widget.LinearLayout

class OutterLayout @JvmOverloads constructor(
  context: Context,
  attrs: AttributeSet? = null
) : LinearLayout(context, attrs) {

  override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
    Log.d("tsss", "[$TAG] [begin] dispatchTouchEvent")
    val flag = super.dispatchTouchEvent(ev)
    Log.d("tsss", "[$TAG] dispatchTouchEvent $flag")
    return flag
  }

  override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean {
    Log.d("tsss", "[$TAG] [begin] onInterceptTouchEvent")
    val flag = super.onInterceptTouchEvent(ev)
    Log.d("tsss", "[$TAG] onInterceptTouchEvent $flag")
    return flag
  }

  override fun onTouchEvent(event: MotionEvent?): Boolean {
    Log.d("tsss", "[$TAG] [begin] onTouchEvent")
    val flag = super.onTouchEvent(event)
    Log.d("tsss", "[$TAG] onTouchEvent $flag")
    return flag
  }

  companion object {
    private const val TAG = "OutterLayout"
  }
}